#include "ExpressionContext.h"
#include "StatementContext.h"
#include "FunctionContext.h"    

CExpressionContext::CExpressionContext(std::weak_ptr<CStatementContext> InParentSentence, std::weak_ptr<CExpressionContext> InParentExpression)
{
    ParentSentence = InParentSentence;
    ParentExpression = InParentExpression;
}

std::shared_ptr<CStatementContext> CExpressionContext::GetSentence()
{
    return ParentSentence.lock();
}

std::shared_ptr<CFunctionContext> CExpressionContext::GetFunction()
{
    return GetSentence()->GetFunction();
}

std::shared_ptr<CTypeDescription> CExpressionContext::GetOwnerClass()
{
    return GetFunction()->GetOwnerClass();
}

std::shared_ptr<CExpressionContext> CExpressionContext::NewSubExpression()
{
    return GetSentence()->NewExpression(shared_from_this());
}
